<?php

class indexControl extends commonControl {

    function index() {
        $db = M("model");
        $model = $db->field("mid,mname,title")->all();
        $this->assign("model", $model);
        $this->display();
    }

    function login_show() {
        $this->display();
    }

    function login() {
        if ($this->rbac_user_login($_POST['username'], md5($_POST['password']), "admin")) {
            go("index");
        }
    }

    function welcome() {
        $uploadsize = ini_get("upload_max_filesize"); //允许上传的单个文件最大值
        $gd = gd_info(); //获得GD库所有信息
        $gdversion = $gd['GD Version']; //获得GD库版本
        $diskspace = get_size(disk_free_space('.'));
        $system = array(
            "phpversion" => PHP_VERSION,
            "phpos" => PHP_OS,
            "uploadsize" => $uploadsize,
            "gdversion" => $gdversion,
            "diskspace" => $diskspace
        );
        $db = M();
        $system['mysqlversion'] = $db->get_version();
        $this->assign("system", $system);
        $this->display();
    }

    //退出
    function quit() {
        session_unset();
        session_destroy();
        go("index/login_show");
    }

}